package com.herui.ota.controller;

import com.herui.ota.config.ControllerNames;
import com.herui.ota.entity.BaseTree;
import com.herui.ota.service.DeviceOtaTreeService;
import com.mlnx.common.annotations.NeedLogin;
import com.mlnx.common.entity.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.shan.spring.base.BaseController;
import org.shan.spring.base.annotations.SysLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = ControllerNames.OTATreeName + "接口", tags = {ControllerNames.OTATreeName + "接口"})
@SysLog(title = ControllerNames.OTATreeName)
@RestController
@RequestMapping("/otatree")
public class OTATreeController extends BaseController {
    @Autowired
    private DeviceOtaTreeService service;

    @NeedLogin
    @ApiOperation(
            value = "获取所有树",
            notes = ""
    )
    @GetMapping({"/all"})
    public ResponseData<List<BaseTree>> getDeviceOtaTrees() {
        return this.result(service.getDeviceOtaTrees());
    }

}
